package com.fr.privilege.authority;

import com.fr.base.XMLable;
import com.fr.base.xml.XMLPrintWriter;
import com.fr.base.xml.XMLReadable;
import com.fr.base.xml.XMLableReader;
import com.fr.privilege.allocation.Allocation;

public class AuthorityAllocation
  implements XMLable
{
  public static final String XML_TAG = "AuthorityAllocation";
  private Authority authority;
  private Allocation allocation;

  public AuthorityAllocation()
  {
  }

  public AuthorityAllocation(Authority paramAuthority, Allocation paramAllocation)
  {
    this.authority = paramAuthority;
    this.allocation = paramAllocation;
  }

  public Authority getAuthority()
  {
    return this.authority;
  }

  public void setAuthority(Authority paramAuthority)
  {
    this.authority = paramAuthority;
  }

  public Allocation getAllocation()
  {
    return this.allocation;
  }

  public void setAllocation(Allocation paramAllocation)
  {
    this.allocation = paramAllocation;
  }

  public void readXML(XMLableReader paramXMLableReader)
  {
    if (paramXMLableReader.isChildNode())
    {
      Object localObject;
      String str = paramXMLableReader.getTagName();
      if ("Authority".equals(str))
      {
        localObject = null;
        if ((localObject = paramXMLableReader.getAttr("name")) != null)
          setAuthority(new Authority((String)localObject));
      }
      else if ("Allocation".equals(str))
      {
        localObject = new Allocation();
        paramXMLableReader.readXMLObject((XMLReadable)localObject);
        setAllocation((Allocation)localObject);
      }
    }
  }

  public void writeXML(XMLPrintWriter paramXMLPrintWriter)
  {
    if (this.authority != null)
    {
      paramXMLPrintWriter.startTAG("AuthorityAllocation");
      this.authority.writeXML(paramXMLPrintWriter);
      if (this.allocation != null)
        this.allocation.writeXML(paramXMLPrintWriter);
      paramXMLPrintWriter.end();
    }
  }

  public Object clone()
    throws CloneNotSupportedException
  {
    AuthorityAllocation localAuthorityAllocation = (AuthorityAllocation)super.clone();
    localAuthorityAllocation.allocation = ((Allocation)this.allocation.clone());
    localAuthorityAllocation.authority = ((Authority)this.authority.clone());
    return localAuthorityAllocation;
  }
}